<html>
  <head>
  <script>
    //React when a browser action's icon is clicked.
    chrome.browserAction.onClicked.addListener(function(tab) {
        chrome.tabs.executeScript(null, {file: "jquery-1.4.2.min.js", allFrames: true});
        chrome.tabs.executeScript(null, {file: "drift.js", allFrames: true});
    });

    chrome.extension.onRequest.addListener(function(request, sender) {
        if(request.driftState == "drifting") {
            chrome.browserAction.setIcon({path:"active19.png", tabId:sender.tab.id});
            chrome.browserAction.setBadgeText({text:"", tabId: sender.tab.id});
        } else if(request.driftState == "loading") {
            chrome.browserAction.setBadgeText({text:"...", tabId: sender.tab.id});
        } else if(request.driftState == "stopped") {
            chrome.browserAction.setIcon({path:"drift19.png", tabId:sender.tab.id});
            chrome.browserAction.setBadgeText({text:"", tabId: sender.tab.id});
        }
    });

  </script>
  </head>
</html>
